resources:
- name: api-grpc
  resource:
    '@type': type.googleapis.com/envoy.config.cluster.v3.Cluster
    connectTimeout: 100s
    edsClusterConfig:
      edsConfig:
        ads: {}
        resourceApiVersion: V3
    lbPolicy: RANDOM
    name: api-grpc
    type: EDS
    typedExtensionProtocolOptions:
      envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
        '@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
        commonHttpProtocolOptions:
          idleTimeout: 103s
          maxStreamDuration: 105s
        explicitHttpConfig:
          http2ProtocolOptions: {}
- name: api-http
  resource:
    '@type': type.googleapis.com/envoy.config.cluster.v3.Cluster
    connectTimeout: 5s
    edsClusterConfig:
      edsConfig:
        ads: {}
        resourceApiVersion: V3
    name: api-http
    outlierDetection:
      enforcingConsecutive5xx: 100
      enforcingConsecutiveGatewayFailure: 0
      enforcingConsecutiveLocalOriginFailure: 0
      enforcingFailurePercentage: 0
      enforcingSuccessRate: 0
    type: EDS
    typedExtensionProtocolOptions:
      envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
        '@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
        commonHttpProtocolOptions:
          idleTimeout: 0s
        explicitHttpConfig:
          http2ProtocolOptions: {}
- name: api-http2
  resource:
    '@type': type.googleapis.com/envoy.config.cluster.v3.Cluster
    connectTimeout: 100s
    edsClusterConfig:
      edsConfig:
        ads: {}
        resourceApiVersion: V3
    lbPolicy: RING_HASH
    name: api-http2
    ringHashLbConfig:
      hashFunction: MURMUR_HASH_2
      maximumRingSize: "1024"
      minimumRingSize: "64"
    type: EDS
    typedExtensionProtocolOptions:
      envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
        '@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
        commonHttpProtocolOptions:
          idleTimeout: 103s
        explicitHttpConfig:
          http2ProtocolOptions: {}
- name: api-tcp
  resource:
    '@type': type.googleapis.com/envoy.config.cluster.v3.Cluster
    connectTimeout: 100s
    edsClusterConfig:
      edsConfig:
        ads: {}
        resourceApiVersion: V3
    lbPolicy: LEAST_REQUEST
    leastRequestLbConfig:
      choiceCount: 4
    name: api-tcp
    type: EDS
    typedExtensionProtocolOptions:
      envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
        '@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
        explicitHttpConfig:
          http2ProtocolOptions: {}
- name: backend
  resource:
    '@type': type.googleapis.com/envoy.config.cluster.v3.Cluster
    connectTimeout: 5s
    edsClusterConfig:
      edsConfig:
        ads: {}
        resourceApiVersion: V3
    lbPolicy: MAGLEV
    name: backend
    type: EDS
    typedExtensionProtocolOptions:
      envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
        '@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
        explicitHttpConfig:
          http2ProtocolOptions: {}
- name: db-c182dd9f4bf584d7
  resource:
    '@type': type.googleapis.com/envoy.config.cluster.v3.Cluster
    connectTimeout: 5s
    edsClusterConfig:
      edsConfig:
        ads: {}
        resourceApiVersion: V3
    name: db-c182dd9f4bf584d7
    type: EDS
    typedExtensionProtocolOptions:
      envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
        '@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
        explicitHttpConfig:
          http2ProtocolOptions: {}
- name: db-f7d9086d4169338b
  resource:
    '@type': type.googleapis.com/envoy.config.cluster.v3.Cluster
    connectTimeout: 5s
    edsClusterConfig:
      edsConfig:
        ads: {}
        resourceApiVersion: V3
    name: db-f7d9086d4169338b
    type: EDS
    typedExtensionProtocolOptions:
      envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
        '@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
        explicitHttpConfig:
          http2ProtocolOptions: {}
- name: api-grpc
  resource:
    '@type': type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment
    clusterName: api-grpc
    endpoints:
    - lbEndpoints:
      - endpoint:
          address:
            socketAddress:
              address: 192.168.0.4
              portValue: 8089
        loadBalancingWeight: 1
        metadata:
          filterMetadata:
            envoy.lb:
              kuma.io/protocol: grpc
            envoy.transport_socket_match:
              kuma.io/protocol: grpc
- name: api-http
  resource:
    '@type': type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment
    clusterName: api-http
    endpoints:
    - lbEndpoints:
      - endpoint:
          address:
            socketAddress:
              address: 192.168.0.4
              portValue: 8084
        loadBalancingWeight: 1
        metadata:
          filterMetadata:
            envoy.lb:
              kuma.io/protocol: http
              region: us
            envoy.transport_socket_match:
              kuma.io/protocol: http
              region: us
      - endpoint:
          address:
            socketAddress:
              address: 192.168.0.5
              portValue: 8085
        loadBalancingWeight: 1
        metadata:
          filterMetadata:
            envoy.lb:
              kuma.io/protocol: http
              region: eu
            envoy.transport_socket_match:
              kuma.io/protocol: http
              region: eu
- name: api-http2
  resource:
    '@type': type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment
    clusterName: api-http2
    endpoints:
    - lbEndpoints:
      - endpoint:
          address:
            socketAddress:
              address: 192.168.0.4
              portValue: 8088
        loadBalancingWeight: 1
        metadata:
          filterMetadata:
            envoy.lb:
              kuma.io/protocol: http2
            envoy.transport_socket_match:
              kuma.io/protocol: http2
- name: api-tcp
  resource:
    '@type': type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment
    clusterName: api-tcp
    endpoints:
    - lbEndpoints:
      - endpoint:
          address:
            socketAddress:
              address: 192.168.0.6
              portValue: 8086
        loadBalancingWeight: 1
        metadata:
          filterMetadata:
            envoy.lb:
              kuma.io/protocol: http
              region: us
            envoy.transport_socket_match:
              kuma.io/protocol: http
              region: us
      - endpoint:
          address:
            socketAddress:
              address: 192.168.0.7
              portValue: 8087
        loadBalancingWeight: 1
        metadata:
          filterMetadata:
            envoy.lb:
              region: eu
            envoy.transport_socket_match:
              region: eu
- name: backend
  resource:
    '@type': type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment
    clusterName: backend
    endpoints:
    - lbEndpoints:
      - endpoint:
          address:
            socketAddress:
              address: 192.168.0.1
              portValue: 8081
        loadBalancingWeight: 1
        metadata:
          filterMetadata:
            envoy.lb:
              region: us
            envoy.transport_socket_match:
              region: us
      - endpoint:
          address:
            socketAddress:
              address: 192.168.0.2
              portValue: 8082
        loadBalancingWeight: 1
- name: db-c182dd9f4bf584d7
  resource:
    '@type': type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment
    clusterName: db-c182dd9f4bf584d7
    endpoints:
    - lbEndpoints:
      - endpoint:
          address:
            socketAddress:
              address: 192.168.0.3
              portValue: 5433
        loadBalancingWeight: 1
        metadata:
          filterMetadata:
            envoy.lb:
              role: replica
            envoy.transport_socket_match:
              role: replica
- name: db-f7d9086d4169338b
  resource:
    '@type': type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment
    clusterName: db-f7d9086d4169338b
    endpoints:
    - lbEndpoints:
      - endpoint:
          address:
            socketAddress:
              address: 192.168.0.3
              portValue: 5432
        loadBalancingWeight: 1
        metadata:
          filterMetadata:
            envoy.lb:
              role: master
            envoy.transport_socket_match:
              role: master
- name: outbound:127.0.0.1:18080
  resource:
    '@type': type.googleapis.com/envoy.config.listener.v3.Listener
    address:
      socketAddress:
        address: 127.0.0.1
        portValue: 18080
    filterChains:
    - filters:
      - name: envoy.filters.network.tcp_proxy
        typedConfig:
          '@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
          cluster: backend
          idleTimeout: 0s
          statPrefix: backend
    metadata:
      filterMetadata:
        io.kuma.tags:
          kuma.io/service: backend
    name: outbound:127.0.0.1:18080
    trafficDirection: OUTBOUND
- name: outbound:127.0.0.1:40001
  resource:
    '@type': type.googleapis.com/envoy.config.listener.v3.Listener
    address:
      socketAddress:
        address: 127.0.0.1
        portValue: 40001
    filterChains:
    - filters:
      - name: envoy.filters.network.http_connection_manager
        typedConfig:
          '@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          accessLog:
          - name: envoy.access_loggers.file
            typedConfig:
              '@type': type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
              logFormat:
                textFormatSource:
                  inlineString: |
                    [%START_TIME%] mesh1 "%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% "%REQ(X-FORWARDED-FOR)%" "%REQ(USER-AGENT)%" "%REQ(X-B3-TRACEID?X-DATADOG-TRACEID)%" "%REQ(X-REQUEST-ID)%" "%REQ(:AUTHORITY)%" "gateway" "api-http" "10.0.0.1" "%UPSTREAM_HOST%"
              path: /var/log
          commonHttpProtocolOptions:
            idleTimeout: 0s
          httpFilters:
          - name: envoy.filters.http.router
            typedConfig:
              '@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
          routeConfig:
            name: outbound:api-http
            requestHeadersToAdd:
            - header:
                key: x-kuma-tags
                value: '&kuma.io/service=gateway&'
            validateClusters: false
            virtualHosts:
            - domains:
              - '*'
              name: api-http
              routes:
              - match:
                  prefix: /
                route:
                  cluster: api-http
                  timeout: 0s
          statPrefix: api-http
          streamIdleTimeout: 0s
    metadata:
      filterMetadata:
        io.kuma.tags:
          kuma.io/service: api-http
    name: outbound:127.0.0.1:40001
    trafficDirection: OUTBOUND
- name: outbound:127.0.0.1:40002
  resource:
    '@type': type.googleapis.com/envoy.config.listener.v3.Listener
    address:
      socketAddress:
        address: 127.0.0.1
        portValue: 40002
    filterChains:
    - filters:
      - name: envoy.filters.network.tcp_proxy
        typedConfig:
          '@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
          accessLog:
          - name: envoy.access_loggers.file
            typedConfig:
              '@type': type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
              logFormat:
                textFormatSource:
                  inlineString: |
                    logstash:1234;[%START_TIME%] %RESPONSE_FLAGS% mesh1 10.0.0.1(gateway)->%UPSTREAM_HOST%(api-tcp) took %DURATION%ms, sent %BYTES_SENT% bytes, received: %BYTES_RECEIVED% bytes
              path: /foo/log
          cluster: api-tcp
          idleTimeout: 101s
          statPrefix: api-tcp
    metadata:
      filterMetadata:
        io.kuma.tags:
          kuma.io/service: api-tcp
    name: outbound:127.0.0.1:40002
    trafficDirection: OUTBOUND
- name: outbound:127.0.0.1:40003
  resource:
    '@type': type.googleapis.com/envoy.config.listener.v3.Listener
    address:
      socketAddress:
        address: 127.0.0.1
        portValue: 40003
    filterChains:
    - filters:
      - name: envoy.filters.network.http_connection_manager
        typedConfig:
          '@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          commonHttpProtocolOptions:
            idleTimeout: 103s
          httpFilters:
          - name: envoy.filters.http.router
            typedConfig:
              '@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
          routeConfig:
            name: outbound:api-http2
            requestHeadersToAdd:
            - header:
                key: x-kuma-tags
                value: '&kuma.io/service=gateway&'
            validateClusters: false
            virtualHosts:
            - domains:
              - '*'
              name: api-http2
              routes:
              - match:
                  prefix: /
                route:
                  cluster: api-http2
                  timeout: 102s
          statPrefix: api-http2
          streamIdleTimeout: 0s
    metadata:
      filterMetadata:
        io.kuma.tags:
          kuma.io/service: api-http2
    name: outbound:127.0.0.1:40003
    trafficDirection: OUTBOUND
- name: outbound:127.0.0.1:40004
  resource:
    '@type': type.googleapis.com/envoy.config.listener.v3.Listener
    address:
      socketAddress:
        address: 127.0.0.1
        portValue: 40004
    filterChains:
    - filters:
      - name: envoy.filters.network.http_connection_manager
        typedConfig:
          '@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          commonHttpProtocolOptions:
            idleTimeout: 103s
          httpFilters:
          - name: envoy.filters.http.grpc_stats
            typedConfig:
              '@type': type.googleapis.com/envoy.extensions.filters.http.grpc_stats.v3.FilterConfig
              emitFilterState: true
          - name: envoy.filters.http.router
            typedConfig:
              '@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
          routeConfig:
            name: outbound:api-grpc
            requestHeadersToAdd:
            - header:
                key: x-kuma-tags
                value: '&kuma.io/service=gateway&'
            validateClusters: false
            virtualHosts:
            - domains:
              - '*'
              name: api-grpc
              routes:
              - match:
                  prefix: /
                route:
                  cluster: api-grpc
                  timeout: 102s
          statPrefix: api-grpc
          streamIdleTimeout: 104s
    metadata:
      filterMetadata:
        io.kuma.tags:
          kuma.io/service: api-grpc
    name: outbound:127.0.0.1:40004
    trafficDirection: OUTBOUND
- name: outbound:127.0.0.1:54321
  resource:
    '@type': type.googleapis.com/envoy.config.listener.v3.Listener
    address:
      socketAddress:
        address: 127.0.0.1
        portValue: 54321
    filterChains:
    - filters:
      - name: envoy.filters.network.tcp_proxy
        typedConfig:
          '@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
          idleTimeout: 0s
          statPrefix: db
          weightedClusters:
            clusters:
            - name: db-f7d9086d4169338b
              weight: 10
            - name: db-c182dd9f4bf584d7
              weight: 90
    metadata:
      filterMetadata:
        io.kuma.tags:
          kuma.io/service: db
    name: outbound:127.0.0.1:54321
    trafficDirection: OUTBOUND
